package thread;

public class MyThreadLocal {
    static volatile ThreadLocal<Integer> threadLocal1 = new ThreadLocal<>();
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
            System.out.println(threadLocal1.get());
            threadLocal1.set(0);
            System.out.println(threadLocal1.get());
        });

        Thread t2 = new Thread(()->{
            System.out.println(threadLocal1.get());
            threadLocal1.set(1);
            System.out.println(threadLocal1.get());
        });
        t1.start();
        t1.join();
        t2.start();

    }
}
